#include <iostream>
using std::cout;
using std::endl;



/* template <class T, int kBase> */
/* T multiply(T x, T y){ */
/*     return x * y * kBase; */
/* } */

/* void test0(){ */
/*     double x = 1.2, y = 1.2; */
/*     //无法隐式实例化 */
/*     /1* cout << multiply(x,y) << endl; *1/ */
/*     cout << multiply<double,10>(x,y) << endl; */
/* } */

#if 0
template <class T, int kBase = 10>
T multiply(T x, T y){
    return x * y * kBase;
}

void test0(){
    double x = 1.2, y = 1.2;
    //模板的非类型参数赋予默认值后
    //调用模板时可以隐式实例化
    cout << multiply(x,y) << endl;
    cout << multiply<double>(x,y) << endl;
    cout << multiply<double,100>(x,y) << endl;
}
#endif

/* template <class T = int, int kBase = 10> */
/* T multiply(T x, T y){ */
/*     return x * y * kBase; */
/* } */

template <class T1 = int, class T2 = int, int kBase = 10>
T1 multiply(T1 x, T2 y){
    return x * y * kBase;
}

void test0(){
    double x = 1.2, y = 1.2;
    //模板的非类型参数赋予默认值后
    //调用模板时可以隐式实例化
    cout << multiply(x,y) << endl;
    cout << multiply<double>(x,y) << endl;
    cout << multiply<double,double>(x,y) << endl;
    cout << multiply<double,double,100>(x,y) << endl;
}

int main(void){
    test0();
    return 0;
}
